Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
A little while ago, we wondered whether WriteProcessMemory was faster than shared memory for transferring data between two processes, and the conclusion is that it wasn’t. Shared memory, as its name implies, shares the memory between two processes: The two processes are accessing the same memory; there are no copies. On the other hand, the implementation of WriteProcessMemory allocates a transfer buffer, copies the data from the source to the transfer buffer, then changes memory context to the destination, and then copies the data from the transfer buffer to the destination. But could WriteProcessMemory be optimized to avoid this copy?
I mean, I guess you could do that in theory. I’m thinking, maybe create a memory descriptor list (MDL), lock and map the pages into kernel mode while in the context of the source, then change context to the destination and copy the memory to the destination. Repeat until all the memory has been copied. You don’t want to allocate a single MDL for the entire source block because the program might say that it wants to copy 100GB of memory, and if you didn’t cap the size of the transfer buffer, that would lock 100GB of RAM.
But it seems overkill and unnecessary to lock the source pages. It’s fine for them to be pageable. We’re okay with them faulting in as necessary.
I don’t know if there’s a way to map memory from one process into another except by locking it. I don’t spend a lot of time in kernel mode. But you do have to be careful that the mapping goes into the kernel address space and not the user-mode address space. Putting it in the user-mode address space would be a security vulnerability because the destination process can see the bytes on the source page that are not part of the memory being copied.¹
But really, all of this effort is pointless. We saw that the purpose of the WriteProcessMemory function is not inter-process communication (IPC) but to be a tool for debuggers. Debuggers are typically writing just a few bytes at a time, say, to patch a breakpoint instruction, and the WriteProcessMemory function actually goes out of its way to write the memory, even in the face of incompatible memory protections, though it does so in a not-thread-safe way. But that’s okay because the destination process is presumably frozen by the debugger when it calls WriteProcessMemory. A debugger is not going to patch a process while it’s actively running. The lack of atomicity means that patching a running process could result in the process seeing torn state, like a partly-patched variable or even a partly-patched instruction.
In summary, WriteProcessMemory was not intended to be used as an inter-process communication channel. Its intended client is a debugger that is using it to patch bytes in a process being debugged. The very high level of access required to call the function (PROCESS_VM_WRITE) is not suitable for an inter-process communication channel, since it basically gives the writer full pwnage over the process being written to. In the case of a debugger, you want the debugger to have complete and total control of the process being debugged. But in the case of IPC, you don’t want to give your clients that high a level of access to your process. And even if you get past that, the lack of atomicity and lack of control over the order in which the bytes become visible in the target process means that WriteProcessMemory is not suitable as an IPC mechanism anyway. There’s no point trying to make a bad idea more efficient.
¹ Or you could try it the other way: Map the destination into the source. But now you are giving the source read access to the destination bytes that share the same page as the destination buffer, even though the source may not have PROCESS_VM_READ access.
The post Could <CODE>WriteProcessMemory</CODE> be made faster by avoiding the intermediate buffer? appeared first on The Old New Thing.
Read more of this story at Slashdot.
Talk show host Stephen Colbert said CBS forbade him from interviewing Texas Democratic Senate candidate James Talarico because of a Federal Communications Commission threat to enforce the equal-time rule on late-night and daytime talk shows.
Talarico "was supposed to be here, but we were told in no uncertain terms by our network's lawyers, who called us directly, that we could not have him on the broadcast," Colbert said on last night's episode of The Late Show with Stephen Colbert. "Then I was told in some uncertain terms that not only could I not have him on, I could not mention me not having him on, and because my network clearly doesn't want us to talk about this, let's talk about this."
Colbert went on to describe some of the background Ars readers are already familiar with. FCC Chairman Brendan Carr recently issued a warning to late-night and daytime talk shows that they may no longer qualify for the bona fide news exemption to the equal-time rule, and subsequently opened an investigation into ABC’s The View after an interview with Talarico.
Formally known as the Equal Opportunities Rule, the rule generally requires that stations giving time to one political candidate provide comparable time and placement to opposing candidates if any opposing candidate makes a request. The rule has an exemption for candidate appearances on bona fide news programs, and entertainment talk shows have generally been treated as bona fide news programs for this purpose.
The equal-time rule is "the FCC's most time-honored rule, right after 'no nipples at the Super Bowl,'" Colbert said. Carr's recent letter "said he was thinking about dropping the exception for talk shows because he said some of them were motivated by partisan purposes," Colbert said, while accusing Carr of being motivated by partisan purposes himself.
"Let's just call this what it is: Donald Trump's administration wants to silence anyone who says anything bad about Trump on TV because all Trump does is watch TV. He's like a toddler with too much screen time," Colbert said. Colbert also said he's not allowed to show a photo of Talarico, but simultaneously showed a photo of the candidate.
Colbert played audio of a recent Carr interview in which the FCC chairman said, "If [Jimmy] Kimmel and Colbert want to continue to do their programming, they don't want to have to comply with this requirement, then they can go to a cable channel or a podcast or a streaming service and that's fine."
Colbert said he "decided to take Brendan Carr's advice" and interviewed Talarico for a segment posted on his show's YouTube channel. "The network says I can't give you a URL or a QR code but I promise you if you go to our YouTube page, you'll find it," Colbert said. That interview is available here.
Colbert described the unequal treatment of late-night talk shows and talk radio. "Carr here claims he's just getting partisanship off the airwaves but the FCC is also in charge of regulating radio broadcasts. And what would you know, Brendan Carr says right-wing talk radio isn't a target of the FCC's equal time notice," Colbert said.
Colbert pointed out that a mere threat, and not an actual rule change, caused CBS to forbid him from interviewing a candidate. "At this point, he's just released a letter that says he's thinking about doing away with the exception for late night, he hasn't done away with it yet," Colbert said. "But my network is unilaterally enforcing it as if he had. But I want to assure you this decision is for purely financial reasons."
We contacted CBS and Paramount today and will update this article if we get a response.
Colbert's tenure as host is scheduled to end in May. CBS announced it would end the show last year after Colbert called CBS owner Paramount's $16 million settlement with Trump “a big fat bribe.” Paramount subsequently won FCC approval of an $8 billion merger with Skydance, while agreeing to Carr's demand to install a "bias monitor."
FCC Democrat Anna Gomez said today that CBS forbidding the interview with Talarico "is yet another troubling example of corporate capitulation in the face of this administration’s broader campaign to censor and control speech. The FCC has no lawful authority to pressure broadcasters for political purposes or to create a climate that chills free expression. CBS is fully protected under the First Amendment to determine what interviews it airs, which makes its decision to yield to political pressure all the more disappointing."
Gomez said Paramount "has regulatory matters before the government, but corporate interests cannot justify retreating from airing newsworthy content." She urged broadcasters "to stand firm against these unlawful pressures and continue exercising their constitutional right to speak freely and without government interference.”
Harold Feld, a longtime telecom attorney who is senior VP of consumer advocacy group Public Knowledge, said today that "if what Colbert says is true, CBS needs new lawyers. Even the strictest reading of the equal time rule doesn’t prevent someone from saying the name of a candidate or talking about a URL. Even if the rule applied, CBS would not be required to offer an equal opportunity to Republican candidates at this time. Because Rep. Talarico is still a candidate in the primary, only his two primary opponents—Rep. Jasmine Crocket (D-Texas) and Ahmad Hassan—are entitled to equal opportunity. Nor did CBS have any responsibility to offer equal time to them; candidates must make a request on their own."
Feld called the incident "disgraceful behavior by both CBS and the chairman of the FCC.” With the FCC targeting late-night TV but not talk radio, Feld said it appears that "broadcast appearances by Trump-friendly candidates will continue to receive exemptions from this rule while appearances by Trump-disapproved candidates will not." Paramount's capitulation seems to be more about "finding an excuse to curry favor with President Trump, rather than any concern over the equal time rule," he said.
The Foundation for Individual Rights and Expression (FIRE) said that "candidate interviews have long been exempt from 'equal time' rules for good reason. It would be wrong if a Democratic administration demanded conservative talk radio hosts give equal airtime when they interview candidates, and it’s wrong for the Trump administration to demand the same of late night talk show hosts."
FIRE Chief Counsel Robert Corn-Revere said that by "putting pressure on late night talk shows critical of the Trump administration while openly admitting that conservative talk radio is immune from the FCC’s ire," Carr is "making himself the poster boy for big government putting its thumb on the scale of political debate."